package com.zhanghu.model;

import com.zhanghu.model.computer.AsusComputer;
import com.zhanghu.model.computer.Computer;
import com.zhanghu.model.computer.DellComputer;
import com.zhanghu.model.computer.HpComputer;
import com.zhanghu.model.factory.AsusComputerFactory;
import com.zhanghu.model.factory.ComputerFactory;
import com.zhanghu.model.factory.DellComputerFactory;
import com.zhanghu.model.factory.HpComputerFactory;

/**
 * @Author: zhanghu
 * @Description: 工厂测试类
 * @Date: Create in 16:04 2020/1/14
 * @modified by:
 */
public class ComputerTest {
    public static void main(String[] args) {
        //asus华硕
        //这里其实有两步
        //1.通过new AsusComputerFactory()获取工厂对象
        //2.通过调用getComputer()方法获取电脑对象,即：
        //ComputerFactory computerFactory = new ComputerFactory();
        //Computer asusComputer = computerFactory.getComputer();
        //asusComputer.brand();
        Computer asusComputer = new AsusComputerFactory().getComputer();
        asusComputer.brand();
        //hp惠普
        Computer hpComputer = new HpComputerFactory().getComputer();
        hpComputer.brand();
        //dell戴尔
        Computer dellComputer = new DellComputerFactory().getComputer();
        dellComputer.brand();



    }
}
